<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Admin_ScrumTeams.aspx.cs" Inherits="Admin_ScrumTeams" Title="Tackle - Administration of Scrum Teams" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHolder" runat="Server">
    <strong>Administer Scrum Teams<br />
    </strong>
    <br />
    <span style="font-size: 8pt">This page contains the details associated with different
        scrum teams.</span><br />
    <br />
    <asp:UpdatePanel runat="server" ID="UPGridView" UpdateMode="Conditional">
        <ContentTemplate>
            <table style="width: 98%" cellpadding="4" cellspacing="0">
                <tr>
                    <td bgcolor="#e3eaeb" style="border-right: silver 1px ridge; border-top: silver 1px ridge;
                        border-left: silver 1px ridge; border-bottom: silver 1px ridge">
                        <span style="font-size: x-small">Page size:</span><strong> </strong>
                        <asp:DropDownList ID="dlPageSize" runat="server" AutoPostBack="True" Font-Names="Verdana"
                            Font-Size="X-Small" OnSelectedIndexChanged="dlPageSize_SelectedIndexChanged">
                            <asp:ListItem>10</asp:ListItem>
                            <asp:ListItem>25</asp:ListItem>
                            <asp:ListItem>50</asp:ListItem>
                            <asp:ListItem>100</asp:ListItem>
                            <asp:ListItem>All</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:GridView ID="gvScrumTeam" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            CellPadding="4" DataKeyNames="ScrumTeamID" DataSourceID="dsScrumTeam" Font-Names="Verdana"
                            Font-Size="X-Small" ForeColor="#333333" GridLines="None" OnPreRender="gvScrumTeam_PreRender"
                            OnRowDeleting="gvScrumTeam_RowDeleting" OnRowEditing="gvScrumTeam_RowEditing" AllowPaging="True">
                            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:BoundField DataField="ScrumTeamID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                                    SortExpression="ScrumTeamID" Visible="False" />
                                <asp:TemplateField HeaderText="Team Name" SortExpression="ScrumTeamName">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                            Text='<%# Bind("ScrumTeamName") %>' MaxLength="50" ToolTip="The name of the scrum team"></asp:TextBox><asp:RequiredFieldValidator
                                                ID="rfv1" runat="server" ControlToValidate="TextBox1" ErrorMessage="*?" ForeColor="LightCoral"
                                                Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ScrumTeamName") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Scrum Master" SortExpression="ScrumMaster">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                            Text='<%# Bind("ScrumMaster") %>' MaxLength="20" ToolTip="The ScrumMaster for the team. Supply the Alias user name."></asp:TextBox><asp:RequiredFieldValidator
                                                ID="rfv2" runat="server" ControlToValidate="TextBox2" ErrorMessage="*?" ForeColor="LightCoral"
                                                Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("ScrumMaster") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Product Backlog" SortExpression="ScrumTeamProductListID">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dsOtherScrumTeams"
                                            DataTextField="ScrumTeamName" DataValueField="ScrumTeamID" Font-Names="Verdana"
                                            Font-Size="X-Small" SelectedValue='<%# Bind("ScrumTeamProductListID") %>'>
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("AltScrumTeamName") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="False" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Show Master Backlog In Weeks?" SortExpression="ShowMasterBacklogInWeeks">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("ShowMasterBacklogInWeeks") %>'
                                            ToolTip="Display the product and master backlog in weeks. If not checked, hours will be used." />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chbShowInWeeks" runat="server" Checked='<%# Bind("ShowMasterBacklogInWeeks") %>'
                                            Enabled="False" ToolTip="Display the product and master backlog in weeks. If not checked, hours will be used." />
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="True" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Show Sprint Backlog in Days?" SortExpression="ShowSprintBacklogInDays">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("ShowSprintBacklogInDays") %>'
                                            ToolTip="Display the sprint backlog in days. If not checked, hours will be used." />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("ShowSprintBacklogInDays") %>'
                                            Enabled="False" ToolTip="Display the sprint backlog in days. If not checked, hours will be used." />
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="True" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Confirm DS Entry?" SortExpression="ConfirmDailyTimeEntry">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox5" runat="server" Checked='<%# Bind("ConfirmDailyTimeEntry") %>'
                                            ToolTip="With this checked, adding time on the Daily Scrum Entry page will force the user to update the current task status." />
                                    </EditItemTemplate>
                                    <HeaderStyle Wrap="True" />
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox4" runat="server" Checked='<%# Bind("ConfirmDailyTimeEntry") %>'
                                            Enabled="False" ToolTip="With this checked, adding time on the Daily Scrum Entry page will force the user to update the current task status." />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Disable DS User Filter?" SortExpression="DisableDailyTimeUserFilter">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox6" runat="server" Checked='<%# Bind("DisableDailyTimeUserFilter") %>'
                                            ToolTip="With this checked, the Daily Scrum User Filter is disabled. Scrum team members can only look at their own tasks. Non-team members who have access can see all tasks." />
                                    </EditItemTemplate>
                                    <HeaderStyle Wrap="True" />
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox6" runat="server" Checked='<%# Bind("DisableDailyTimeUserFilter") %>'
                                            Enabled="False" ToolTip="With this checked, the Daily Scrum User Filter is disabled. Scrum team members can only look at their own tasks. Non-team members who have access can see all tasks." />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Show Task IDs" SortExpression="ShowTaskID">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("ShowTaskID") %>' ToolTip="Turn this on to display the Task ID on all pages and reports that display tasks." />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("ShowTaskID") %>' Enabled="false"
                                            ToolTip="Turn this on to display the Task ID on all pages and reports that display tasks." />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Show Feature IDs" SortExpression="ShowMBID">
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox4" runat="server" Checked='<%# Bind("ShowMBID") %>' ToolTip="Turn this on to display the Feature ID on all pages and reports that display features." />
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("ShowMBID") %>' Enabled="false"
                                            ToolTip="Turn this on to display the Feature ID on all pages and reports that display features." />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Time Reporting Day" SortExpression="TimeReportingDay">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="ddTimeReportDay" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                            SelectedValue='<%# Bind("TimeReportingDay") %>' ToolTip="The day in which time entries are bound to in a week. If All is selected, all days are available for time entry.">
                                            <asp:ListItem Selected="True" Value="0">All</asp:ListItem>
                                            <asp:ListItem Value="1">Sunday</asp:ListItem>
                                            <asp:ListItem Value="2">Monday</asp:ListItem>
                                            <asp:ListItem Value="3">Tuesday</asp:ListItem>
                                            <asp:ListItem Value="4">Wednesday</asp:ListItem>
                                            <asp:ListItem Value="5">Thursday</asp:ListItem>
                                            <asp:ListItem Value="6">Friday</asp:ListItem>
                                            <asp:ListItem Value="7">Saturday</asp:ListItem>
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddTimeReportDay" runat="server" Enabled="False" Font-Names="Verdana"
                                            Font-Size="X-Small" SelectedValue='<%# Bind("TimeReportingDay") %>' ToolTip="The day in which time entries are bound to in a week. If All is selected, all days are available for time entry.">
                                            <asp:ListItem Selected="True" Value="0">All</asp:ListItem>
                                            <asp:ListItem Value="1">Sunday</asp:ListItem>
                                            <asp:ListItem Value="2">Monday</asp:ListItem>
                                            <asp:ListItem Value="3">Tuesday</asp:ListItem>
                                            <asp:ListItem Value="4">Wednesday</asp:ListItem>
                                            <asp:ListItem Value="5">Thursday</asp:ListItem>
                                            <asp:ListItem Value="6">Friday</asp:ListItem>
                                            <asp:ListItem Value="7">Saturday</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                    <HeaderStyle Wrap="True" />
                                </asp:TemplateField>
                                <asp:CommandField ShowEditButton="True" />
                                <asp:TemplateField ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                            ForeColor="Black" OnClientClick="return confirm('Are you sure you want to delete this record?');"
                                            Text="Delete" ToolTip="Delete this record"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <RowStyle BackColor="#E3EAEB" />
                            <EditRowStyle BackColor="#7C6F57" />
                            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnNewTeam" runat="server" Font-Size="X-Small" OnClick="btnNewTeam_Click"
                            Text="New Team" Font-Names="Verdana" />
                        <asp:Label ID="lblCantDelete" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                            ForeColor="Red" Text="The team cannot be deleted as associated team items exist."
                            Visible="False"></asp:Label></td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:SqlDataSource ID="dsScrumTeam" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        DeleteCommand="DELETE FROM tblScrumTeam WHERE (ScrumTeamID = @original_ScrumTeamID)"
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT tblScrumTeam.ScrumTeamID, tblScrumTeam.ScrumTeamName, tblScrumTeam.ScrumMaster, tblScrumTeam.ShowMasterBacklogInWeeks, ISNULL(tblScrumTeam_1.ScrumTeamName, tblScrumTeam.ScrumTeamName) AS AltScrumTeamName, tblScrumTeam.ScrumTeamProductListID, tblScrumTeam.ShowSprintBacklogInDays, tblScrumTeam.TimeReportingDay, tblScrumTeam.ConfirmDailyTimeEntry, tblScrumTeam.DisableDailyTimeUserFilter, tblScrumTeam.ShowTaskID, tblScrumTeam.ShowMBID FROM tblScrumTeam LEFT OUTER JOIN tblScrumTeam AS tblScrumTeam_1 ON tblScrumTeam.ScrumTeamProductListID = tblScrumTeam_1.ScrumTeamID ORDER BY tblScrumTeam.ScrumTeamName"
        UpdateCommand="UPDATE tblScrumTeam SET ScrumTeamName = @ScrumTeamName, ScrumMaster = @ScrumMaster, ScrumTeamProductListID = @ScrumTeamProductListID, ShowMasterBacklogInWeeks = @ShowMasterBacklogInWeeks, ShowSprintBacklogInDays = @ShowSprintBacklogInDays, TimeReportingDay = @TimeReportingDay, ConfirmDailyTimeEntry = @ConfirmDailyTimeEntry, DisableDailyTimeUserFilter = @DisableDailyTimeUserFilter, ShowTaskID = @ShowTaskID, ShowMBID = @ShowMBID WHERE (ScrumTeamID = @original_ScrumTeamID)">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="dsOtherScrumTeams" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        OnSelecting="dsOtherScrumTeams_Selecting" ProviderName="<%$ ConnectionStrings:TackleConnectionStringMain.ProviderName %>"
        SelectCommand="SELECT ScrumTeamID, ScrumTeamName FROM tblScrumTeam WHERE (ScrumTeamProductListID <> @CurrentScrumTeam) OR (ScrumTeamID = @CurrentScrumTeam) ORDER BY ScrumTeamName">
        <SelectParameters>
            <asp:Parameter Name="CurrentScrumTeam" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
